2 # Copyright 2011 Paul Haensch
3 # This file is part of Busy
5 # Busy is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # Busy is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
15 # You should have received a copy of the GNU Affero General Public License
16 # along with Busy. If not, see <http://www.gnu.org/licenses/>.
18 $ACL_CREATETASK || echo "Location: ?p=Error&i=noaccess\n\n"
19 $ACL_CREATETASK || exit 0
23 [ -z "$info" ] && info="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
24 descfile="$_DATA/Tasks/$info.meta"
25 commfile="$_DATA/Tasks/$info.comment.$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
27 [ -f "$_DATA/Tasks/$info.lock" ] && rm "$_DATA/Wiki/$info.lock"
28 anchor=$(ls $_DATA/Tasks |grep -A2 $info |grep '.meta$' |tail -n1 |cut -d. -f1)
31 headline="$_POST[\"headline\"]"
32 taskstatus="$_POST[\"status\"]"
33 section="$_POST[\"section\"]"
34 description="$_POST[\"description\"]"
35 comment="$_POST[\"comm\"]"
36 [ -n "$_POST[\"cancel\"]" ] && cancel=true
37 [ "$_POST[\"submit\"]" = "Robots click here" ] && cancel=true
39 if [ -z "$cancel" -a -n "$comment" ]; then
40 touch "$_DATA/Tasks/$info"
41 echo -e "author=${USER}" > "$commfile"
42 echo -e "${comment}" >> "$commfile"
43 echo -n "Location: ?p=Tasks&i=$info\n\n"
44 elif [ -z "$cancel" -a -n "$description" ]; then
45 touch "$_DATA/Tasks/$info"
46 echo -e "headline=${headline}" > "$descfile"
47 echo -e "status=${taskstatus}" >> "$descfile"
48 echo -e "section=${section}" >> "$descfile"
49 echo -e "${description}" >> "$_DATA/Tasks/$info"
50 echo -n "Location: ?p=Tasks#$anchor\n\n"
51 elif [ -n "$cancel" ]; then
52 echo -n "Location: ?p=Tasks#$anchor\n\n"